class Solution {
public:
    vector<int> getSneakyNumbers(vector<int>& nums) {
        int n = nums.size();
        vector<bool> table(n - 2, false);
        vector<int> res;
        for (int i : nums)
            if (table[i] == true) res.push_back(i);
            else table[i] = true;

        return res;
    }
};